/*
 * @function:这个是用来下载整个网页源代码文件的。
 */

package com.wjd.spider;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class Downloader {

    public Document download(String url) throws IOException {
        Map<String, String> params = new HashMap<>();
        params.put("searcharg", "java");
        params.put("searchtype", "t");
        params.put("SORT", "DZ");
        params.put("extended", "0");

        return Jsoup.connect(url)
                .userAgent("Mozilla")
                .data(params)
                .timeout(10 * 1000)
                .get();
    }

}
